//
//  ManagerButton.m
//  ZhuoxinAgriculture
//
//  Created by stone on 16/11/8.
//  Copyright © 2016年 KKING. All rights reserved.
//

#import "ManagerButton.h"
#import "Masonry.h"
@interface ManagerButton()

@end
@implementation ManagerButton
- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        
//        [self addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        
        UILabel * nameLabel = ({
            UILabel * label = [[UILabel alloc] init];
  
            label.numberOfLines = 0;
            label.textColor = [UIColor whiteColor];
            label.textAlignment = NSTextAlignmentCenter;
            label.text = @"默认内容";
            label.font = [UIFont systemFontOfSize:14];
            
            [self addSubview:label];
            
            [label mas_makeConstraints:^(MASConstraintMaker * make) {
                make.centerX.mas_equalTo(self.mas_centerX).offset(0);
                make.bottom.mas_equalTo(self.mas_bottom).offset(0);
            }];
            label;
        });
        self.nameLabel = nameLabel;        
        
        UIImageView * iconImageView = ({
            UIImageView * imageView = [[UIImageView alloc] init];
            
            imageView.userInteractionEnabled = NO;
            [self addSubview:imageView];
            
            [imageView mas_makeConstraints:^(MASConstraintMaker * make) {
                make.centerX.mas_equalTo(self.mas_centerX).offset(0);
                make.centerY.mas_equalTo(self.mas_centerY).offset(0);
                
                make.width.mas_equalTo(self.mas_width).multipliedBy(1/1.0);;
                make.height.mas_equalTo(imageView.mas_width).multipliedBy(1/1.0);
            }];
            
            imageView;
        });
        self.iconImageView = iconImageView;
        
        
        
    }
    return self;
}
- (void)btnClick:(ManagerButton *)sender
{
    NSLog(@"%@ | %s",self.class,__func__);
}
@end
